#Author: Salvatore Gionfriddo
from Agent import Agent
from random import randint
class RandomAgent(Agent):
    def __init__(self):
        self.state = None
        self.available_actions = []
    def Initialize(self, state, aa):
        self.state = state
        self.available_actions = aa
    def SelectNextAction(self):
        while True:
            action = randint(0,len(self.available_actions)-1)
            if self.available_actions[action] == 1:
                return action
    def ApplyResult(self, state, reward, aa):
        self.available_actions = aa
        self.state = state
